bitkeeper revision 1.1159.29.1 (411d0591E5q-eH5VYLKCC5XcKgmqCw)
authoriap10@labyrinth.cl.cam.ac.uk <iap10@labyrinth.cl.cam.ac.uk>
Fri, 13 Aug 2004 18:16:49 +0000 (18:16 +0000)
committeriap10@labyrinth.cl.cam.ac.uk <iap10@labyrinth.cl.cam.ac.uk>
Fri, 13 Aug 2004 18:16:49 +0000 (18:16 +0000)
fixes

tools/libxc/xc_linux_restore.c
tools/libxc/xc_linux_save.c
xen/common/dom0_ops.c
xen/include/hypervisor-ifs/dom0_ops.h

index c50aae4052161ad23a33aadeca31ab730f330283..0c1ca91ffc766597234e7631c59a3704ec84f081 100644 (file)
@@ -11,7 +11,7 @@
 
 #define MAX_BATCH_SIZE 1024
 
-#define DEBUG 0
+#define DEBUG 1
 
 #if DEBUG
 #define DPRINTF(_f, _a...) printf ( _f , ## _a )
@@ -365,7 +365,7 @@ int xc_linux_restore(int xc_handle, XcIOContext *ioctxt)
                 goto out;
             }
 
-            switch( region_pfn_type[i] )
+            switch( region_pfn_type[i] & LTABTYPE_MASK )
             {
             case 0:
                 break;
@@ -473,8 +473,9 @@ int xc_linux_restore(int xc_handle, XcIOContext *ioctxt)
      */
     for ( i = 0; i < nr_pfns; i++ )
     {
-        if ( pfn_type[i] == L1TAB )
+        if ( pfn_type[i] == (L1TAB|LPINTAB) )
         {
+printf("XXXXXXXXXXXXXXX pin L1\n");
             if ( add_mmu_update(xc_handle, mmu,
                                 (pfn_to_mfn_table[i]<<PAGE_SHIFT) | 
                                 MMU_EXTENDED_COMMAND,
@@ -484,8 +485,9 @@ int xc_linux_restore(int xc_handle, XcIOContext *ioctxt)
                 goto out;
             }
         }
-        else if ( pfn_type[i] == L2TAB )
+        else if ( pfn_type[i] == (L2TAB|LPINTAB) )
         {
+printf("XXXXXXXXXXXXXXX pin L2\n");
             if ( add_mmu_update(xc_handle, mmu,
                                 (pfn_to_mfn_table[i]<<PAGE_SHIFT) | 
                                 MMU_EXTENDED_COMMAND,
@@ -544,7 +546,7 @@ int xc_linux_restore(int xc_handle, XcIOContext *ioctxt)
 
     /* Uncanonicalise the page table base pointer. */
     pfn = ctxt.pt_base >> PAGE_SHIFT;
-    if ( (pfn >= nr_pfns) || (pfn_type[pfn] != L2TAB) )
+    if ( (pfn >= nr_pfns) || ((pfn_type[pfn]&LTABTYPE_MASK) != L2TAB) )
     {
         printf("PT base is bad. pfn=%lu nr=%lu type=%08lx %08lx\n",
                pfn, nr_pfns, pfn_type[pfn], (unsigned long)L2TAB);
index 1d4a05425745b1c9001858eb4d8bd2a23f43657e..c3089955c9cee5fab033aef921154e9b98ed2ee2 100644 (file)
@@ -13,7 +13,7 @@
 #define BATCH_SIZE 1024   /* 1024 pages (4MB) at a time */
 
 #define DEBUG 1
-#define DDEBUG 0
+#define DDEBUG 1
 
 #if DEBUG
 #define DPRINTF(_f, _a...) printf ( _f , ## _a )
@@ -639,7 +639,7 @@ int xc_linux_save(int xc_handle, XcIOContext *ioctxt)
 
                     set_bit( n, to_fix );
                     if( iter>1 )
-                        DDPRINTF("netbuf race: iter %d, pfn %lx. mfn %lx\n",
+                        DDPRINTF("netbuf race: iter %d, pfn %x. mfn %lx\n",
                                  iter,n,pfn_type[batch]);
                     continue;
                 }
@@ -658,7 +658,7 @@ int xc_linux_save(int xc_handle, XcIOContext *ioctxt)
                 batch++;
             }
      
-            DDPRINTF("batch %d:%d (n=%d)\n", iter, batch, n);
+//            DDPRINTF("batch %d:%d (n=%d)\n", iter, batch, n);
 
             if ( batch == 0 )
                 goto skip; /* vanishingly unlikely... */
@@ -714,12 +714,12 @@ printf("type fail: page %i mfn %08lx\n",j,pfn_type[j]);
                     continue;
                 }
   
-                if ( ((pfn_type[j] & LTAB_MASK) == L1TAB) || 
-                     ((pfn_type[j] & LTAB_MASK) == L2TAB) ){
+                if ( ((pfn_type[j] & LTABTYPE_MASK) == L1TAB) || 
+                     ((pfn_type[j] & LTABTYPE_MASK) == L2TAB) ){
                     memcpy(page, region_base + (PAGE_SIZE*j), PAGE_SIZE);
       
                     for ( k = 0; 
-                          k < (((pfn_type[j] & LTAB_MASK) == L2TAB) ? 
+                          k < (((pfn_type[j] & LTABTYPE_MASK) == L2TAB) ? 
                                (HYPERVISOR_VIRT_START >> L2_PAGETABLE_SHIFT) :
                                1024); 
                           k++ ){
@@ -898,7 +898,6 @@ printf("nrpfns according to suspend record is %ld\n", p_srec->nr_pfns );
 
     /* Canonicalise each GDT frame number. */
     for ( i = 0; i < ctxt.gdt_ents; i += 512 ) {
-       ctxt.gdt_frames[i], live_mfn_to_pfn_table[ctxt.gdt_frames[i]]);
         if ( !translate_mfn_to_pfn(&ctxt.gdt_frames[i]) ) {
             xcio_error(ioctxt, "GDT frame is not in range of pseudophys map");
             goto out;
index 0a4086ef6e06de8206bbfde9a8d70208076a290e..6c8abcb8f8a2b490dbfe0b4f5db810cd6e2c76ea 100644 (file)
@@ -610,6 +610,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
                 if ( likely(get_page(page, d)) )
                 {
                     unsigned long type = 0;
+
                     switch( page->u.inuse.type_info & PGT_type_mask )
                     {
                     case PGT_l1_page_table:
@@ -625,7 +626,10 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
                         type = L4TAB;
                         break;
                     }
-                    l_arr[j] |= type;
+
+                   if ( page->u.inuse.count_info & PGC_guest_pinned )
+                       type |= LPINTAB;
+                   l_arr[j] |= type;
                     put_page(page);
                 }
                 else
index 8cea03fac2897d6cbfcfc1c1a9661cb3737d92a9..ed6f9dbb37ca7ab59c00959fdc3d8a84fc134ee7 100644 (file)
@@ -178,8 +178,11 @@ typedef struct {
 #define L2TAB (2<<28)
 #define L3TAB (3<<28)
 #define L4TAB (4<<28)
+#define LPINTAB  (1<<31)
 #define XTAB  (0xf<<28) /* invalid page */
 #define LTAB_MASK XTAB
+#define LTABTYPE_MASK (0x7<<28)
+
 typedef struct {
     /* IN variables. */
     memory_t pfn;          /*  0: Machine page frame number to query.       */